package com.baizhiedu.basic.autoDesignProcessors.beanFactoryPostProcessors;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;

/**
 * @Author songyahui
 * @Date 2023/8/9 11:55
 * @Description 自定义一个beanFactoryPostProcessor实现
 */
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

    public String way;

    public MyBeanFactoryPostProcessor() {

    }

    public MyBeanFactoryPostProcessor(String arg) {
        this.way = arg;
    }

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
        for (String string : configurableListableBeanFactory.getBeanDefinitionNames()) {
            System.out.println(string);
        }
        System.out.println("俺这是MyBeanFactoryPostProcessor.postProcessBeanFactory()W(`0`)W～" + way);
    }
}
